home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Utilities.h
-
- Contains: Location Manager SDK Sample Module handy routines
-
- Version: ALM SDK 1.0
- Package: Location Manager SDK 1.0
-
- Copyright: © 1984-1997 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs@apple.com
-
- */
-
- #ifndef __UTILITIES__
- #define __UTILITIES__
-
- // -------------------------------------------------------------------------------------
-
- // Project Includes...
-
- #ifndef __SAMPLE__
- #include "Sample.h"
- #endif // __SAMPLE__
-
- // SDK Includes...
-
- #define ALM_BASENAME()
- #define ALM_GLOBALS() GlobalsHandle
-
- #ifndef __LOCATIONMANAGER__
- #include <LocationManager.h>
- #endif // __LOCATIONMANAGER__
-
- // MacOS Includes...
-
- #ifndef __COMPONENTS__
- #include <Components.h>
- #endif // __COMPONENTS__
-
- // -------------------------------------------------------------------------------------
-
- // Module-specific defines...
-
- #define kModuleVersion 0
- #define kSettingVersion 1
-
- // -------------------------------------------------------------------------------------
-
- // Types...
-
- typedef struct {
- UInt32 dateCreated; // Date file created &
- UInt32 dateModified; // Date file modified == "changed" indicator...
- UInt32 dataForkOffset; // Relative position of data fork data...
- UInt32 dataForkLen; // Length of data fork data...
- UInt32 resForkOffset; // Resource fork data position...
- UInt32 resForkLen; // Length of resource fork data...
- } FileInfoRec, *FileInfoPtr;
-
- typedef struct {
- Component self; // Reference back to ourselves for closure...
- SInt32 resFile; // Reference for our open resource fork...
- UInt32 fileCount; // Number of records below...
- FSSpec theFiles[kVariableLengthArray];
- } Globals, *GlobalsPtr, **GlobalsHandle;
-
- typedef struct {
- UInt32 version; // Version of the setting...
- UInt32 fileCount; // Number of records below...
- FileInfoRec fileInfo[kVariableLengthArray];
- // actual file data follows array...
- } SettingRec, *SettingPtr, **SettingHandle;
-
- // -------------------------------------------------------------------------------------
-
- // Exports...
-
- extern OSErr
- UseSetting (GlobalsHandle globals, SettingHandle setting, ALMRebootFlags* flags);
- // Make 'setting' the current setting...
-
- extern OSErr
- ReadSetting (GlobalsHandle globals, SettingHandle setting);
- // Read the system state into setting...
-
- extern OSErr
- ConfirmFSSpecs (GlobalsHandle globals);
- // Ensure that the FSSpec array in globals conforms to the resource list of files
- // to look for...
-
- extern void
- InsParamStr (StringPtr matchThis, StringPtr replaceWithThis, StringPtr replaceInThis);
- // Insert 'replaceWithThis' into 'replaceInThis' at the first instance of
- // 'matchThis'...
-
- #endif // __UTILITIES__
-